package com.wxy.controller;
import com.wxy.service.EchartAnalysisService;
import com.wxy.service.EchartIndustryService;
import com.wxy.vo.EchartAnalysis;
import com.wxy.vo.EchartIndustryLineVo;
import com.wxy.vo.EchartIndustryPieVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author wxy
 * @since 2022-01-12
 */
@RestController
@RequestMapping("/industryTrendFirst")
public class IndustryTrendFirstController {

    @Autowired
    private EchartIndustryService echartIndustryService;

    @Autowired
    private EchartAnalysisService echartAnalysisService;

    //Line图
    @GetMapping("/getOverview/{selectIndustry}")
    public EchartIndustryLineVo getOverview(
            @PathVariable("selectIndustry") Integer selectIndustry
    ){
        switch (selectIndustry){
            case 1:
                return echartIndustryService.getEchartDataByOverview();
            case 2:
                return echartIndustryService.getEchartDataByAgricultural();
            case 3:
                return echartIndustryService.getEchartDataByForestry();
            case 4:
                return echartIndustryService.getEchartDataByHusbandry();
            case 5:
                return echartIndustryService.getEchartDataByFishery();
            case 6:
                return echartIndustryService.getEchartDataByMining();
            case 7:
                return echartIndustryService.getEchartDataByManufacturing();
            case 8:
                return echartIndustryService.getEchartDataByConstruction();
            case 9:
                return echartIndustryService.getEchartDataByFinancial();
            case 10:
                return echartIndustryService.getEchartDataByFood();
            case 11:
                return echartIndustryService.getEchartDataByTechnology();
            case 12:
                return echartIndustryService.getEchartDataByRetail();
            case 13:
                return echartIndustryService.getEchartDataByEducation();
        }
       return null;
    }

    //pie图
    @GetMapping("/getPieData/{selectIndustryByPie}")
    public EchartIndustryPieVo getPieData(
            @PathVariable("selectIndustryByPie") Integer selectIndustryByPie
    ){
        switch (selectIndustryByPie){
            case 1:
                return echartIndustryService.getEchartDataByIndustryTotal();
            case 2:
                return echartIndustryService.getEchartDataByFirst();
            case 3:
                return echartIndustryService.getEchartDataBySecond();
            case 4:
                return echartIndustryService.getEchartDataByThird();
        }
        return null;
    }

    //数据分析--官方接口
    @GetMapping("/getAnalysis/{change}")
    public EchartAnalysis getAnalysis(
            @PathVariable("change") Integer change
    ){
        switch (change){
            case 1:
                return echartAnalysisService.getQuarterAnalysis();
            case 2:
                return echartAnalysisService.getTemperatureAnalysis();
            case 3:
                return echartAnalysisService.getWeatherAnalysis();
            case 4:
                return echartAnalysisService.getOwnAnalysis();
        }
        return null;
    }
}

